home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / local / sbin / restart-tor < prev    next >
Encoding:
Text File  |  2013-01-10  |  719 b   |  23 lines

  1. #!/bin/sh
  2.  
  3. set -e
  4.  
  5. service tor restart
  6.  
  7. # The main point of this script is to make sure that if vidalia is
  8. # running, and Tor is restarted, then we also restart Vidalia. This is
  9. # because Vidalia doesn't re-connect to Tor automatically, so the user
  10. # has to restart it to be able to control Tor again. Also, any options
  11. # set by Vidalia will be lost since they weren't written to torrc.
  12. if pgrep "\<vidalia\>" >/dev/null; then
  13.     killall vidalia
  14.     # Since Tor just restarted we wait for a while until the
  15.     # ControlPort hopefully is up.
  16.     local counter=0
  17.     until [ "${counter}" -ge 10 ] || nc -z localhost 9051 2>/dev/null; do
  18.         sleep 1
  19.         counter=$((${counter}+1))
  20.     done
  21.     restart-vidalia
  22. fi
  23.